A common and useful method of error handling employs the On Error VBScript directive. By placing the following lines around a section of code, the script engine will ignore any run-time errors that may occur in that section.
|
On Error Resume Next 'code On Error GoTo 0 |
This can be useful for potentially erroneous calls that might otherwise cause the script to exit on an error, such as UIS commands and ActiveX control methods. Use caution when disabling run-time errors; some problems can be missed if errors are disabled for large blocks of code. In general it is best to surround only the troublesome areas with these lines.